package grpc

import (
	"context"
	"manager/bll"
	"proto/base"
	"proto/dto"
)

type Device struct {
}

func (e *Device) AesInfo(ctx context.Context, in *dto.AesInfoRequest, out *dto.AesInfoReplay) error {
	info, err := bll.Ebike.AesInfo(ctx, in.Sn)
	if err != nil {
		return err
	}

	*out = dto.AesInfoReplay{
		AesKey: []byte(info.AESKey),
		Iv:     []byte(info.IV),
	}
	return err
}

func (e *Device) StartTrack(context.Context, *dto.StartTrackRequest, *dto.StartTrackReply) error {
	return nil
}

func (e *Device) StopTrack(context.Context, *dto.StopTrackRequest, *base.Empty) error {
	return nil
}
